package com.jacobson.core.framework.lifecycle

import android.app.Activity
import android.app.Application
import android.os.Bundle
import com.jacobson.core.widget.logger.Logger
import com.jacobson.core.widget.logger.LoggerFactory
import javax.inject.Inject
import javax.inject.Singleton

/**
 * ================================================
 *
 * @author Wucz on 2018/7/18 17:14
 * ================================================
 */

@Singleton
class RxActivityLifecycleImpl @Inject constructor() : Application.ActivityLifecycleCallbacks {
    private val logger: Logger = LoggerFactory.getLogger()
/*
    @Inject
    lateinit var fragmentLifecycle: Lazy<RxFragmentLifecycle>*/

    override fun onActivityPaused(activity: Activity?) {
        logger.w("RxActivityLifecycleImpl-> onActivityPaused: ${activity?.let { it::class.simpleName }}")
    }

    override fun onActivityResumed(activity: Activity?) {
        logger.w("RxActivityLifecycleImpl-> onActivityResumed: ${activity?.let { it::class.simpleName }}")
    }

    override fun onActivityStarted(activity: Activity?) {
        logger.w("RxActivityLifecycleImpl-> onActivityStarted: ${activity?.let { it::class.simpleName }}")
    }

    override fun onActivityDestroyed(activity: Activity?) {
        logger.w("RxActivityLifecycleImpl-> onActivityDestroyed: ${activity?.let { it::class.simpleName }}")
    }

    override fun onActivitySaveInstanceState(activity: Activity?, outState: Bundle?) {
        logger.w("RxActivityLifecycleImpl-> onActivitySaveInstanceState: ${activity?.let { it::class.simpleName }}")
    }

    override fun onActivityStopped(activity: Activity?) {
        logger.w("RxActivityLifecycleImpl-> onActivityStopped: ${activity?.let { it::class.simpleName }}")
    }

    override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {
        logger.w("RxActivityLifecycleImpl-> onActivityCreated: ${activity?.let { it::class.simpleName }}")
    }
}